﻿/*----------------------------------------------------------------
    // Copyright (C) 2010 江苏华招网
    // 版权所有。 
    // 作者：王广浩 
    //
    // 文件名：HospitalLoginPrice.ashx.cs
    // 文件功能描述：医疗机构价格填报
    // 创建标识：
   ---------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.SessionState;
namespace HZ.DrugTrade.Web.Hospitals.Procurement
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    public class HospitalLoginPrice : IHttpHandler,IRequiresSessionState  
    {

        public void ProcessRequest(HttpContext context)
        {
            try
            {
                // context.Response.ContentType = "text/plain";
                // context.Response.Write("Hello World");
                string GoodsID = context.Request["GoodsID"];
                string HospitalID = context.Request["HospitalID"];
                string price = context.Request["price"];
                int count = Convert.ToInt32(context.Request["CountProduces"]);
                if (string.IsNullOrEmpty(GoodsID) || string.IsNullOrEmpty(HospitalID) || string.IsNullOrEmpty(price))
                {
                    context.Response.Write("2");
                }
                else
                {
                    HZ.DrugTrade.BLL.BLL_HospitalLoginPriceGoods bll = new HZ.DrugTrade.BLL.BLL_HospitalLoginPriceGoods();
                    HZ.DrugTrade.Model.View.HospitalLoginPriceGoods where = new HZ.DrugTrade.Model.View.HospitalLoginPriceGoods();
                    where.GoodsID = GoodsID.Trim();
                    where.HospitalID = HospitalID.Trim();
                    where.HospitalName = CurrentAccount.GetUser().UserName;//医疗机构名称
                    where.AreaID = CurrentAccount.GetUser().Org.Area.AreaID;//地区ID
                    where.Price = new HZ.Common.ConvertHelper(price).ToDouble;//价格
                    where.CountProduces = new HZ.Common.ConvertHelper(count).ToInt32;//数量)

                    context.Response.Write(bll.UpdateGoodsLoginPrice(where));
                }
            }
            catch (Exception)
            {
                
                throw;
            }
          

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
